//LIBTCOD is (c) J.C.Wilk (http://jice.nospam.googlepages.com/)
//LIBTCOD_D PORT is a work by W."Uiriamu" F.M
//Kept as faithful to original as possible.
//Licensed under BSD license as the original libtcod.
//Provided as free download at http://code.google.com/p/ariayakita

//! To use libtcod_d you only need to import this module.
//!-----------------------------------------------------------------------------------------------------

//     +-------------- SEARCHING CODE -----------------+   //
//     |    To find something make a search like:      |   //
//     |    bresenham_d         <-- for bresenham      |   //
//     |    internal_d          <-- for libtcod_int    |   //
//     |    types_d             <-- for all types      |   //
//     +-----------------------------------------------+   //


module libtcod_d;

extern(C) {

//original libtcod uses those as macros
int MAX(int a, int b) {
    return (a < b) ? b : a;
}
int MIN(int a, int b) {
    return (a > b) ? b : a;
}
int ABS(int a) {
    return (a < 0) ? -a : a;
}
int CLAMP(int a, int b, int x) {
    return (x < a) ? a : (x > b) ? b : x;
}
int LERP(int a,int b, int x) {
    return  (a + x) * (b - a);
}

//! Starts types_d
//!-----------------------------------------------------------------------------------------------------

//original libtcod uses those typedefs. compatibility reasons I assume.
alias ubyte uint8;
alias byte int8;
alias ushort uint16;
alias short int16;
alias uint uint32;
alias int int32;

struct _STC1{  // My name convention will be like S for originally Struct, a 2nd (or 3rd) id and a #
	int c;     // character ascii code */
	TCOD_color_t fore;	// foreground color
	TCOD_color_t back;	// background color
	uint8 dirt;	// cell modified since last flush ?
}
alias _STC1 char_t;

struct _SCD1{
	char_t *buf;
	char_t *oldbuf;
	uint8 fade;
	bool windowed;
	bool fullscreen;
	TCOD_color_t fore,back; // foreground (text) and background colors
	int w,h; // console width and height (in characters, each character is 8x8 pixels)
}
alias _SCD1 TCOD_console_data_t;

enum _EA1{
	LEFT,
	CENTER,
	RIGHT
}
alias _EA1 alignment_t;

//! Starts bresenham_d [100% covered - 0.2.0 - 1.3.2]
//!-----------------------------------------------------------------------------------------------------
//TCOD_line_init(int, int, int, int);
export void TCOD_line_init(int xFrom, int yFrom, int xTo, int yTo);
//Advance one step. Returns true if we reach destination.
export bool TCOD_line_step(int *xCur, int *yCur);

//! Starts color_d [100% covered - 0.2.0 - 1.3.2]
//!-----------------------------------------------------------------------------------------------------
//TCOD_color_t
struct _SC1 {
    uint8 r,g,b;
}
alias _SC1 TCOD_color_t;
//TCOD_color_equals(TCOD_color_t,TCOD_color_t)
export bool TCOD_color_equals (TCOD_color_t c1, TCOD_color_t c2);
//TCOD_color_add(TCOD_color_t,TCOD_color_t)
export TCOD_color_t TCOD_color_add (TCOD_color_t c1, TCOD_color_t c2);
//TCOD_color_multiply(TCOD_color_t,TCOD_color_t)
export TCOD_color_t TCOD_color_multiply (TCOD_color_t c1, TCOD_color_t c2);
//TCOD_color_multiply_scalar(TCOD_color_t,float)
export TCOD_color_t TCOD_color_multiply_scalar (TCOD_color_t c1, float value);
//TCOD_color_lerp(TCOD_color_t,TCOD_color_t,float)
export TCOD_color_t TCOD_color_lerp(TCOD_color_t c1, TCOD_color_t c2, float coef);
//TCOD_color_set_HSV(TCOD_color_t,float,float,float)
export void TCOD_color_set_HSV(TCOD_color_t* c,float h, float s, float v);
//TCOD_color_get_HSV(TCOD_color_t,float,float,float)
export void TCOD_color_get_HSV(TCOD_color_t c,float* h, float* s, float* v);


//BLACK
    export TCOD_color_t TCOD_black;
//DARK GREY
    export TCOD_color_t TCOD_dark_grey;
//GREY
    export TCOD_color_t TCOD_grey;
//WHITE
    export TCOD_color_t TCOD_white;
//DARK BLUE
    export TCOD_color_t TCOD_dark_blue;
//LIGHT BLUE
    export TCOD_color_t TCOD_light_blue;
//DARK RED
    export TCOD_color_t TCOD_dark_red;
//LIGHT RED
    export TCOD_color_t TCOD_light_red;
//DARK BROWN
    export TCOD_color_t TCOD_dark_brown;
//LIGHT YELLOW
    export TCOD_color_t TCOD_light_yellow;
//YELLOW
    export TCOD_color_t TCOD_yellow;
//DARK YELLOW
    export TCOD_color_t TCOD_dark_yellow;
//GREEN
    export TCOD_color_t TCOD_green;
//ORANGE
    export TCOD_color_t TCOD_orange;
//RED
    export TCOD_color_t TCOD_red;
//SILVER
    export TCOD_color_t TCOD_silver;
//GOLD
    export TCOD_color_t TCOD_gold;
//PURPLE
    export TCOD_color_t TCOD_purple;
//DARK PURPLE
    export TCOD_color_t TCOD_dark_purple;


//! Starts internal_d [40% covered]
//!-----------------------------------------------------------------------------------------------------







}//extern (C) <- Not to remove

